﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                   assembly="Core"
                   namespace="Core.Model">
  <class name="Cidade" table="CIDADE">
    <id name="Id" column="CIDADE_ID" type="Int32">
      <generator class="native">
        <param name="sequence">GEN_ID_CIDADE</param>
      </generator>
    </id>
    <property name="Nome" column="NOME" length="60" not-null="true" />
    <many-to-one name="EstadoEntity" column="ESTADO_ID" cascade="save-update" not-null="true" />
    <bag name="Empresa" inverse="true" lazy="true" cascade="delete">
      <key column="CIDADE_ID" />
      <one-to-many class="Core.Model.Empresa,Core" />
    </bag>
    <bag name="Loja" inverse="true" lazy="true" cascade="delete">
      <key column="CIDADE_ID" />
      <one-to-many class="Core.Model.Loja,Core" />
    </bag>
  </class>
</hibernate-mapping>